<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li{
            width: 100px;
            height: 35px;
            background: palegoldenrod;
            text-align: center;
            line-height: 35px;
            list-style: none;
            margin: 10px;
        }
    </style>
</head>
<body>
    <ul>
        <li>电脑</li>
        <li>手机</li>
        <li>鼠标</li>
        <li>键盘</li>
    </ul>
    <script>
        var ul = document.querySelector('ul')
        var lis = document.querySelectorAll('li')
        ul.onclick = function(e){
            var target = e.target || e.srcElement
            if(target.tagName == 'LI'){
                console.log(target)
            }
            // console.log(e.target)
        }
    </script>
</body>
</html>